package com.demo.bean;

import com.demo.aop.advisor.Advisor;

import java.util.List;

public interface BeanFactory {

    /**
     * 根据bean的名称获取bean
     * @param name
     * @return
     */
    Object getBean(String name) throws Exception;

    /**
     * 根据bean的名称和 class 获取bean
     * @param name
     * @param clazz
     * @param <T>
     * @return
     */
    <T> T getBean(String name,Class<? extends T> clazz) throws Exception;

    /**
     * 是否包含bean
     * @param name
     * @return
     */
    boolean containBean(String name);

    /**
     * 是否是单例的bean
     * @param name
     * @return
     */
    boolean isSingleton(String name);

    /**
     * 是否是原型bean
     * @param name
     * @return
     */
    boolean isPrototype(String name);

    /**
     * 添加BeanPostProcessor
     */
    void addBeanPostProcessor(BeanPostProcessor beanPostProcessor);
    /**
     * 注册切面
     * @param advisor
     */
    void registryAdvisor(Advisor advisor);

    /**
     * 获取所有的切面信息
     * @return
     */
    List<Advisor> getAdvisors();

}
